<?php
namespace Admin\Controller;

class ProjectSummaryCController extends AbstractController  {
	
	protected $From;

	public function _initialize(){
		$this->Form = D('ProjectsummaryComm');
    }
    
    public function index(){
    	$id = (int)I('id');
    	$this->assign("projectID",$id);
    	$res = $this->Form->MyshowList();
		$this->assign("list",$res['list']);
    	$this->assign("page",$res['page']);
    	$this->display("Project/ProjectSummaryC/index");
    }
	
	public function save($type = false, $id = 0){
		if($type != false){
			if($type == "add"){
				$result = $this->Form->Myupadd();
			}else if($type == "edit"){
				if(I('id')){
					$res = $this->Form->Myshow(array("ID" => (int)I('id')));
					$this->assign("editdata",$res);
					$res = $this->Form->getSummaryList();
					$this->assign("data",$res);
				}
				$this->display("Project/ProjectSummaryC/save");
			}else if($type == "update"){
				$result = $this->Form->Myupdata();
			}
			if($result['state'] == 1 && !empty($result)){
				$this->success($result['msg']);
			}else if($result['state'] == 0 && !empty($result)){
				$this->error($result['msg']);
			}
		}else{
			$res = $this->Form->getSummaryList();
			$this->assign("data",$res);
			$this->display("Project/ProjectSummaryC/save");
		}
	}
	
	public function table(){
		$this->display("Project/ProjectSummaryC/table");
	}

}